using System.Collections.Generic;
using System;

namespace Studio.Game.WordBox
{
    /// <summary>
    /// LengthComparer
    /// </summary>
    public class LengthComparer : IComparer<string>
    {
        // The simplest comparer is:
        // public int Compare(string x, string y) { return x.Length - y.Length; }

        /// <summary>
        /// We make it a little complexer
        /// </summary>
        public int Compare(string x, string y) 
        {
            return (0 == x.Length - y.Length) ? x.CompareTo(y) : x.Length - y.Length;
        }
    }
}
